<?php
    require_once 'core/config.php';
    require_once 'core/string_helper.php';
    require_once 'core/url_helper.php';
    require_once 'core/loader.php';
    
    $model = load_model('crash_model');
    $id = $_GET['id'];
    
    $crash = $model->get_by_id($id);
    
    if (!empty($crash)) {
        $backtrace = $crash['backtrace'];
        $array_backtrace = explode("\n", $backtrace);
        $crash['crash_title'] = "";
        // get libsys.so first crash line
        foreach ($array_backtrace as $line) {
            if (strstr($line, "libsys.so")) {
                $crash['crash_title'] = $line;
                break;
            }
        }
    }
    load_view('main_view', array(
        'crash_reports'=> array($crash),
        'view_mode'=>VIEW_STANDALONE
    ));
?>
